import request from "../utils/request";

const api = {
  getStudentList: "/students",
  createStudent: "/students",
  getStudentDetail: (id) => `/users/${id}`,
  deleteStudent: (id) => `/students/${id}`,
  updateStudent: (id) => `/students/${id}`,
};

export const getStudent = (params = {}) => {
  return request({ url: api.getStudentList, method: "get", params });
};

export const createStudent = (data) => {
  return request({ url: api.createStudent, method: "post", data });
};

export const getUserDetail = (id) => {
  return request({ url: api.getUserDetail(id), method: "get" });
};

export const deleteStudent = (id) => {
  return request({ url: api.deleteStudent(id), method: "DELETE" });
};

export const updateStudent = (data) => {
  return request({ url: api.updateStudent(data.id), method: "PUT", data });
};
